package com.cskaoyan.converter;

import com.cskaoyan.bean.User;
import org.springframework.core.convert.converter.Converter;
import org.springframework.stereotype.Component;

/**
 * @author stone
 * @date 2022/06/01 09:56
 */
@Component
public class String2UserConverter implements Converter<String, User> {
    @Override
    public User convert(String s) {
        //方法里写自定义的转换业务，你需要什么样的业务就写什么样的业务
        User user = new User();
        user.setUsername(s);
        user.setPassword(s);
        return user;
    }
}
